package dao

import (
	"server_cluster/http/model"
)

func (d *Dao) QueryUserDataList(limit, offset int) ([]*model.DbUserDataCut, error) {
	var userDataList []*model.DbUserDataCut = nil
	err := d.db.Limit(limit).Offset(offset).Find(&userDataList).Error
	if err != nil {
		return nil, err
	}
	return userDataList, nil
}

func (d *Dao) QueryUserDataTotalNum() (int64, error) {
	var totalNum int64 = 0
	err := d.db.Table(model.DbUserDataCut{}.TableName()).Count(&totalNum).Error
	if err != nil {
		return 0, err
	}
	return totalNum, nil
}
